package com.roadjava.demo02;

import com.roadjava.Application;
import com.roadjava.Builder;
import com.roadjava.beans.dto.CarDTO;
import com.roadjava.beans.vo.CarVO;
import com.roadjava.convert.demo02.CarConvert02;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
public class MapStructTest02 {

    @Test
    public void test1() {
        CarDTO carDTO = Builder.buildCarDTO();

        CarVO carVO = CarConvert02.INSTANCE.dto2vo(carDTO);
        System.out.println(carVO);
    }

    @Test
    public void test2() {
        CarDTO carDTO = Builder.buildCarDTO();
        List<CarDTO> carDTOList = new ArrayList<>();
        carDTOList.add(carDTO);


        List<CarVO> carVOList = CarConvert02.INSTANCE.dtos2vos(carDTOList);
        System.out.println(carVOList);
    }

}